package com.ruoyi.produce.process.bulletin.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.produce.process.bulletin.domain.Achievement;
import com.ruoyi.produce.process.bulletin.domain.Mold;
import com.ruoyi.produce.process.bulletin.domain.Packing;
import com.ruoyi.produce.process.bulletin.service.IBulletinService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Drj 2021/12/18
 * 车间看板
 */
@RestController
@RequestMapping("/produce/bulletin")
@Api(value = "车间看板模块", tags = "车间看板接口")
public class BulletinController extends BaseController {
    @Autowired
    private IBulletinService bulletinService;
    /**
     * 注塑车间看板信息
     * @return
     */
    @PostMapping("/listMold")
    @ApiOperation("注塑车间看板信息")
    public TableDataInfo listMold(){

        startPage();
        List<Mold> moldList = bulletinService.selectMoldListNew();

        return getDataTable(moldList);
    }
    /**
     * 注塑车间看板信息
     * 柱状图
     * @return
     */
    @PostMapping("/getAchievementInfoListForMold")
    @ApiOperation("注塑车间看板信息 柱状图")
    public AjaxResult getAchievementInfoListForMold(){
        List<Achievement> achievements = bulletinService.selectAchievementInfoListForMold();
        AjaxResult ajax = AjaxResult.success();
        ajax.put("achievements",achievements);
        return ajax;
    }
    /**
     * 包装车间看板信息
     * 柱状图
     * @return
     */
    @PostMapping("/getAchievementInfoListForPack")
    @ApiOperation("包装车间看板信息 柱状图")
    public AjaxResult getAchievementInfoListForPack(){
        List<Achievement> achievements = bulletinService.selectAchievementInfoListForPack();
        AjaxResult ajax = AjaxResult.success();
        ajax.put("achievements",achievements);
        return ajax;
    }


    /**
     * 包装车间车间看板信息
     * @return
     */
    @GetMapping("/packingList")
    @ApiOperation("包装车间车间看板信息")
    public AjaxResult selectPackingList(){
        List<Packing> packingList = bulletinService.selectPackingList();

        return AjaxResult.success(packingList);
    }
}
